﻿@{
    Layout = "";
}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
    <title>客户详细</title>

    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.1.3/css/bootstrap.min.css">

    <link rel="stylesheet" href="~/GoTRI/css/mobiscroll.custom.min.css">
    <link rel="stylesheet" href="~/GoTRI/css/customer-details.css?v=3">
    <link rel="stylesheet" href="~/GoTRI/css/tel-note.css">
    <script src="~/GoTRI/js/jquery-3.2.1.min.js"></script>
    <script src="~/GoTRI/js/popper.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/4.1.3/js/bootstrap.min.js"></script>
    <script src="~/admui-13945148017-1592211513218/public/js/tsk/sweetalert.min.js"></script>
    <style type="text/css" media="screen">


        .inner-input {
            background-color: #fff;
        }

        .inner-input {
            position: relative;
            box-sizing: border-box;
            display: -webkit-box;
            display: -ms-flexbox;
            display: flex;
            -webkit-box-align: center;
            -ms-flex-align: center;
            align-items: center;
            font-size: 16px;
            border-bottom: 1px solid #f2f2f2;
        }

        .to_chose {
            position: absolute;
            right: 15px;
        }
    </style>
    <link href="~/lc_switch.css" rel="stylesheet" />
    @*<script src="~/jquery.min.js"></script>*@
    <script src="~/lc_switch.min.js"></script>
    <script type="text/javascript">
        $('.lcs_check').lc_switch();
    </script>

    <script type="text/javascript">
        var checkfun = function (val, checked) {
            var checkNode = $("[name=dept][value=" + val + "]")
            checked ? checkNode.lcs_on() : checkNode.lcs_off();
        }

        var resetfun = function () {
            window.location.reload();
        }

        $('.save').click(function () {
            // 获取选中的值
            var checkids = [];
            $('[name=dept]:checked').each(function (item) {
                checkids.push($(this).val())
            })
            alert("选中的部门：" + checkids.join(','))
        })
    </script>








    @*<script type="text/javascript">
            $('.lcs_check').lc_switch();
        </script>

        <script type="text/javascript">
            var checkfun = function (val, checked) {
                var checkNode = $("[name=dept][value=" + val + "]")
                checked ? checkNode.lcs_on() : checkNode.lcs_off();
            }

            var resetfun = function () {
                window.location.reload();
            }

            $('.save').click(function () {
                // 获取选中的值
                var checkids = [];
                $('[name=dept]:checked').each(function (item) {
                    checkids.push($(this).val())
                })
                alert("选中的部门：" + checkids.join(','))
            })
        </script>*@

    <script>
        $(document).ready(function () {
            var KeHuId = getQuery("KeHuId");
            BindKeHu(KeHuId);
            BindGenJinJiLu(KeHuId);
            if (getQuery("panduan") == "shouye") {
                $('#a').removeAttr("href");
                $('#a').attr('href', "My_Customer?panduan=shouye&fanhuiweizhi=" + getQuery("fanhuiweizhi") + "&leixing=" + getQuery("leixing") +"");
            } else if (getQuery("panduan") == "geren") {
                $('#a').removeAttr("href");
                $('#a').attr('href', "My_Customer?panduan=geren&fanhuiweizhi=" + getQuery("fanhuiweizhi") + "&leixing=" + getQuery("leixing") +"");
            }
        });

        function BindKeHu(KeHuId) {
            $.ajax({
                type: "POST",
                url: "../PhoneKeHu/BindKeHuJiBenXinXi",
                cache: false,  //禁用缓存
                async: false,
                data: { "KeHuId": "" + KeHuId + "" },  //传入组装的参数
                dataType: "json",
                success: function (result) {
                    for (var i = 0; i < result.length; i++) {
                        $("#lbl_KeHuXingMing").text(result[0].KeHuXingMing);
                        $("#txt_KeHuXingMing").val(result[0].KeHuXingMing);
                        $("#lbl_ZhuangTai").text(result[0].ZhuangTai);
                        $("#lbl_TuiJianShiJian").text(result[0].BeiZhu1);
                        $("#txt_ShouJiHaoMa").val(result[0].ShouJiHaoMa);
                        $("#lbl_ShouJiHaoMa").text(result[0].ShouJiHaoMa);
                        $("#lbl_ShouJiHaoMa1").text(result[0].ShouJiHaoMa);
                        $("#lbl_ShouJiHaoMa2").text(result[0].ShouJiHaoMa);
                        $("#a_DianHuaHaoMa").attr("href", "tel:" + result[0].ShouJiHaoMa);
                        $("#a_FaDuanXin").attr("href", "sms:" + result[0].ShouJiHaoMa);
                        $("#txt_BeiZhu").val(result[0].KeHuBeiZhu);

                        if (result[0].XingBie == "男") {
                            $("#img_TouXiangNan").show();
                            $("#img_TouXiangNv").hide();
                        }
                        else {
                            $("#img_TouXiangNan").hide();
                            $("#img_TouXiangNv").show();
                        }
                        if (result[0].ZhuangTai == "已失效") {
                            $("#CheckBox_ShiFouYouXiao").prop("checked", false);
                            $("#div_BiHuo").attr("class", "lcs_switch lcs_checkbox_switch lcs_off");

                            $("#btn_BaoBei").attr("disabled", "disabled");
                            $("#btn_GenJin").attr("disabled", "disabled");
                            $("#btn_DaoFang").attr("disabled", "disabled");
                        }
                        else {
                            $("#CheckBox_ShiFouYouXiao").prop("checked", true);
                            $("#div_BiHuo").attr("class", "lcs_switch lcs_checkbox_switch lcs_on");

                            $("#btn_BaoBei").removeAttr("disabled");
                            $("#btn_GenJin").removeAttr("disabled");
                            $("#btn_DaoFang").removeAttr("disabled");
                        }

                        //$("#lbl_YiQianYue").text(result[0].YiQianYue);
                        //$("#lbl_YiTuiFang").text(result[0].YiTuiFang);
                        //$("#lbl_YiShiXiao").text(result[0].YiShiXiao);
                    }
                }
            });
        }

        function BindGenJinJiLu(KeHuId) {
            $.ajax({
                type: "POST",
                url: "../PhoneKeHu/BindXiaoShouJiLu",
                cache: false,  //禁用缓存
                data: { "KeHuId": "" + KeHuId + "" },  //传入组装的参数
                dataType: "json",
                success: function (result) {
                    //var left = "";
                    var daofang = false;
                    var yigoumai = false;
                    var right = "";
                    for (var i = 0; i < result.length; i++) {

                        if (result[i].XiaoShouDongZuo == "已认购" && yigoumai == false) {
                            yigoumai = true;
                        }
                        if (result[i].XiaoShouDongZuo == "到访" && daofang == false) {
                            daofang = true;
                        }


                        if (i == 0) {
                            $("#lbl_ShangCiGenJin").text(result[i].CaoZuoShiJian);
                        }

                        //left += "<div><div class=\"circle1 actived\"><div></div></div></div><div class=\"line1\"></div>";

                        var zhiyeguwen = "";
                        if (result[i].XiaoShouDongZuo == "到访") {
                            zhiyeguwen += "" +
                                "<div class=\"item-foot\" style=\"margin-bottom: 5px;\">" +
                                "<span>置业顾问</span>-" +
                                "<span>" + result[i].ZhiYeGuWen + "</span>" +
                                "(<span>" + result[i].ZhiYeGuWenDianHua + "</span>)" +
                                "</div>";
                        }
                        if (result[i].XiaoShouDongZuo == "确认到访") {
                            zhiyeguwen += "" +
                                "<div class=\"item-foot\" style=\"margin-bottom: 5px;\">" +
                                "<span>确认状态</span>-是否到访：" +
                                "<span>" + result[i].QueRenZhuangTai + "</span>" +
                                "</div>";
                        }

                        right += "<div class=\"right-item\">" +
                            "<div class=\"item-tit\">" +
                            "<div class=\"tit-left\"><div><div class=\"circle actived\"><div></div></div></div><span>" + result[i].XiaoShouDongZuo + "</span></div><span>" + result[i].CaoZuoShiJian + "</span>" +


                            //"<span>" + result[i].XiaoShouDongZuo + "</span>" +
                            //"<span>" + result[i].CaoZuoShiJian+"</span>" +
                            "</div>" +
                            "<div class=\"tit-body\">" +
                            "<div class=\"item-content\">" + result[i].MiaoShu + "</div>" + zhiyeguwen +
                            "<div class=\"item-foot\">" +
                            "<span>操作人</span>-" +
                            "<span>" + result[i].CaoZuoRen + "</span>" +
                            "(<span>" + result[i].CaoZuoRenDianHua + "</span>)" +
                            "</div>" +
                            "</div>" +
                            "</div>";

                    }
                    //$("#div_XiaoShouJiLuLine").html(left);
                    $("#div_XiaoShouJiLu").html(right);
                    //console.log(daofang);
                    //console.log(yigoumai);
                    if (daofang == true) {
                        $("#line_DaoFang").attr("class", "line actived");
                        $("#yuan_DaoFang").attr("class", "circle actived")
                    }
                    if (yigoumai == true) {
                        $("#line_GouMai").attr("class", "line actived");
                        $("#yuan_GouMai").attr("class", "circle actived")
                    }

                }
            });
        }

        function XiuGaiKeHu() {
            $("#nb").removeAttr("hidden");
            $("#btn_GengXin").attr("disabled", "disabled");
            var KeHuId = getQuery("KeHuId");
            var XingMing = $("#txt_KeHuXingMing").val();
            var DianHua = $("#txt_ShouJiHaoMa").val();
            var BeiZhu = $("#txt_BeiZhu").val();
            var zt = document.getElementById("CheckBox_ShiFouYouXiao").checked;
            var ZhuangTai = '';
            if (zt == true) {
                ZhuangTai = "有效";
            }
            else {
                ZhuangTai = "失效";
            }
            console.log(ZhuangTai);
            $.ajax({
                type: "POST",
                url: "../PhoneKeHu/XiuGaiKeHu",
                cache: false,  //禁用缓存
                data: { "KeHuId": "" + KeHuId + "", "XingMing": "" + XingMing + "", "DianHua": "" + DianHua + "", "BeiZhu": "" + BeiZhu + "", "ZhuangTai": "" + ZhuangTai + "" },  //传入组装的参数
                dataType: "text",
                success: function (result) {
                    $("#nb").attr("hidden", "");
                    $("#btn_GengXin").removeAttr("disabled");
                    if (result == "success") {
                        swal("成功提示!", "修改成功!", "success");
                        BindKeHu(KeHuId);
                        BindGenJinJiLu(KeHuId);
                    }
                    else {
                        swal("失败提示!", "修改失败!", "error");
                    }

                }
            });
        }


        function baobei() {
            var KeHuId = getQuery("KeHuId");
            location.href = "BaoBei?KeHuId=" + KeHuId + "&panduan=" + getQuery("panduan") + "&fanhuiweizhi=" + getQuery("fanhuiweizhi") + "&leixing=" + getQuery("leixing");
        }
        function genjin() {
            var KeHuId = getQuery("KeHuId");
            location.href = "GenJin?KeHuId=" + KeHuId + "&panduan=" + getQuery("panduan") + "&fanhuiweizhi=" + getQuery("fanhuiweizhi") + "&leixing=" + getQuery("leixing");
        }
        function daofang() {
            var KeHuId = getQuery("KeHuId");
            var GangWeiId = $("#div_GangWeiId").text();
            var RenYuanId = $("#div_RenYuanId").text();
            if (GangWeiId == 34) {
                $.ajax({
                    type: "POST",
                    url: "../PhoneKeHu/ShenQingLaiFang",
                    cache: false,  //禁用缓存
                    data: { "BeiZhu": "客户来访", "ZhiYeGuWenId": "" + RenYuanId + "", "KeHuId": "" + KeHuId + "" },  //传入组装的参数
                    dataType: "text",
                    success: function (result) {
                        if (result == "success") {

                            $.ajax({
                                type: "POST",
                                url: "../PhoneKeHu/QueRenDaoFangSubmit",
                                cache: false,  //禁用缓存
                                async: false,
                                data: { "KeHuId": "" + KeHuId + "", "CaoZuoLeiXing": "querendaofang" },  //传入组装的参数
                                dataType: "text",
                                success: function (result) {
                                    if (result == "success") {
                                        swal("成功提示!", "操作成功!", "success");
                                        setTimeout(function () { window.location.href = "MyCustomerDetail?KeHuId=" + KeHuId + ""; }, 2000);
                                    }
                                    else {
                                        swal("失败提示!", "系统错误!", "error");
                                    }
                                }
                            });
                        }
                        if (result == "error") {
                            swal("失败提示!", "操作出现异常!", "error");
                        }
                    }
                });
            }
            else {

                location.href = "LaiFang?KeHuId=" + KeHuId + "&panduan=" + getQuery("panduan") + "&fanhuiweizhi=" + getQuery("fanhuiweizhi") + "&leixing=" + getQuery("leixing");
            }

        }

        function getQuery(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return decodeURI(r[2]); return null;
        }

        function asdasd() {
            var s = document.getElementById("CheckBox_ShiFouYouXiao").checked;
            console.log(s);
        }
    </script>
</head>


<body>

    <div class="header">
        <a href="" id="a">
            <img src="~/GoTRI/img/myCustomer/icon.png">
        </a>
    </div>
    <div id="div_GangWeiId" style="display:none;">@ViewData["GangWeiId"]</div>
    <div id="div_RenYuanId" style="display:none;">@ViewData["RenYuanId"]</div>
    <!-- 客户信息简介 -->
    <div class="introduction" >
        <div class="head">
            <div class="fl">
                <img src="~/GoTRI/img/男.jpg" id="img_TouXiangNan" style="display:none;">
                <img src="~/GoTRI/img/女.jpg" id="img_TouXiangNv" style="display:none;">
            </div>
            <div class="fr">
                <div class="cus-name">
                    <div><label id="lbl_KeHuXingMing"></label></div>
                    <div class="sign">
                        <span><label id="lbl_ZhuangTai"></label></span>
                    </div>
                </div>
                <div class="sign-time">
                    <span>推荐时间:</span>
                    <span>
                        <label id="lbl_TuiJianShiJian"></label>
                    </span>
                </div>

                <div class="mybtns">
                    <input type="button" name="button" id="btn_GenJin" onclick="genjin();" value="跟进">
                    <input type="button" name="button" id="btn_BaoBei" onclick="baobei();" value="报备">
                    <input type="button" name="button" id="btn_DaoFang" onclick="daofang();" value="到访">
                </div>
            </div>

        </div>
        <div class="contact">
            <div class="tele">
                <div class="tel-img">
                    <img src="~/GoTRI/img/myCustomer/details-tel.png">
                </div>
                <div><span><label id="lbl_ShouJiHaoMa"></label></span></div>
            </div>
            <div class="text">
                <div class="note-img"><img src="~/GoTRI/img/myCustomer/details-note.png"></div>
                <div><span>发送短信</span></div>
            </div>
        </div>

        <!-- 基本信息、客户轨迹 -->
        <div class="info-details">
            <ul class="nav nav-tabs">
                <li class="nav-item">
                    <a href="#baseinfo" class="nav-link active" data-toggle="tab">基本信息</a>
                </li>
                <li class="nav-item">
                    <a href="#custrack" class="nav-link" data-toggle="tab">客户轨迹</a>
                </li>

            </ul>
            <div class="tab-content">
                <!--基本信息 -->
                <div id="baseinfo" class="tab-pane active">
                    <div class="user-tel">
                        <span>手机号码<span class="red">*</span></span>
                        <input type="text" id="txt_ShouJiHaoMa">
                    </div>
                    <div class="user-name">
                        <span>客户姓名<span class="red">*</span></span>
                        <input type="text" id="txt_KeHuXingMing">
                    </div>
                    <div class="inner-input">
                        <span>是否有效</span>
                        <div class="to_chose">
                            <div class="lcs_wrap"><input type="checkbox" id="CheckBox_ShiFouYouXiao" class="lcs_check" name="dept" value="50" checked="" autocomplete="off"><div id="div_BiHuo" class="lcs_switch  lcs_on lcs_checkbox_switch"><div class="lcs_cursor"></div><div class="lcs_label lcs_label_on">有效</div><div class="lcs_label lcs_label_off">失效</div></div></div>
                        </div>
                    </div>
                    <div class="remarks">
                        <span>客户备注</span>
                        <span>
                            上次备注：
                            <span><label id="lbl_ShangCiGenJin"></label></span>
                        </span>
                    </div>
                    <textarea name="beihzu" id="txt_BeiZhu" cols="35" rows="3" placeholder="备注内容"></textarea>
                    @*<button class="btn btn-warning" style="width:100%; color:white;" id="btn_GengXin" onclick="XiuGaiKeHu()">
                            <span>更新</span>
                        </button>*@
                    <div id="nb" hidden="hidden" class="card mb-4" style="right: 0px; left: 0px; -webkit-animation: showSweetAlert .3s; animation: showSweetAlert .3s; margin: 11%; text-align: center; position: fixed; bottom: 40%; border-top-left-radius: 20px; border-top-right-radius: 20px; border-bottom-left-radius: 20px; border-bottom-right-radius: 20px; z-index: 1 ">
                        <img style="margin-left: 20px; margin-right: 20px;height: 200px;" src="~/GoTRI/img/1889835.gif" />
                    </div>
                </div>
                <!-- 客户轨迹 -->
                <div id="custrack" class="tab-pane">
                    <div class="track-top">
                        <div>
                            <span>推荐成功</span>
                            <span>已到访</span>
                            <span>已成交</span>
                        </div>
                        <div>
                            <div>
                                <div class="circle actived">
                                    <div></div>
                                </div>
                            </div>
                            <div class="line" id="line_DaoFang"></div>
                            <div>
                                <div class="circle" id="yuan_DaoFang">
                                    <div></div>
                                </div>
                            </div>
                            <div class="line" id="line_GouMai"></div>
                            <div>
                                <div class="circle" id="yuan_GouMai">
                                    <div></div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="track-body">
                        @*<div class="body-left" id="div_XiaoShouJiLuLine">

                            </div>*@
                        <div class="body-right" id="div_XiaoShouJiLu">


                        </div>
                    </div>
                </div>

            </div>
        </div>
        <!-- 电话插件 -->
        <div id="telephone">
            <div>
                <div class="tel"><label id="lbl_ShouJiHaoMa1"></label></div>
                <div class="mybtn">
                    <div class="cancel">取消</div>
                    <div><a id="a_DianHuaHaoMa"><span style="color:orange;">拨打</span></a></div>
                </div>
            </div>
        </div>
        <!-- 短信插件 -->
        <div id="note">
            <div>
                <div class="tel"><label id="lbl_ShouJiHaoMa2"></label></div>
                <div class="mybtn">
                    <div class="cancel">取消</div>
                    <div><a id="a_FaDuanXin"><span style="color:orange;">发短信</span></a></div>
                </div>
            </div>
        </div>
        <script>

            $(function () {
                //  点击取消，隐藏弹框
                $("#note .cancel").click(function () {
                    $("#note").css({ "display": "none" });
                });
                $("#telephone .cancel").click(function () {
                    $("#telephone").css({ "display": "none" });
                });
                // 点击按钮显示弹框
                // 拨打电话
                $(".tele").click(function () {
                    $("#telephone").css({ "display": "block" });
                });
                // 发送短信
                $(".text").click(function () {
                    $("#note").css({ "display": "block" });
                });
            })
        </script>
    </div>
</body>
</html>